﻿using System.Linq;
using System.Web.Mvc;

namespace SimpleDemo.Controllers
{
    public class FruitAjaxRadioListController : Controller
    {
        public ActionResult GetItems(int? key)
        {
            var res = Db.Fruits.Select(o => new SelectListItem { Text = o.Name, Value = o.Id.ToString(), Selected = (key == o.Id) });

            return Json(res);
        }
    }
}